package com.zzy.chapter4.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.zzy.chapter4.utils.Constants;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AlipayConfig {

    @Bean(name = "alipayClient")
    public AlipayClient alipayClient() {
        return new DefaultAlipayClient(Constants.ALIPAY_GATEWAY_URL,
                Constants.APP_ID,
                Constants.APP_PRIVATE_KEY,
                "json", "UTF-8",
                Constants.ALIPAY_PUBLIC_KEY,
                Constants.SIGN_TYPE);
    }

}
